package javango.forms.widgets;

import java.util.Map;

public interface Widget {

	/**
	 * Returns this Widget rendered as HTML.  
	 * 
	 * The 'value' given is not guaranteed to be valid input, so subclass
	 * implementations should program defensively.
	 * 
	 * @param name
	 * @param value
	 * @param attrs
	 * @return
	 */
	String render(String name, Object value, Map<String, Object>  attrs);

	/**
	 * Returns the value as a simple string,  this is used for ReadOnly representations
	 */
        String asText(Object value);
	
	String[] valueFromMap(Map<String, String[]> map, String name);
	
	Map<String, Object> getAttrs();
	
}
